using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;


public partial class UtilityMain
{
    public static void Destroy(GameObject go)
    {
        GameObject.Destroy(go);
    }

    public static void SafePostEvent(Action action)
    {
        if (action == null)
        {
            return;
        }
        action();
    }
    
    public static void SafePostEvent<T>(Action<T> action, T data)
    {
        if (action == null)
        {
            return;
        }
        action(data);
    }

    public static void SafePostEvent<T0, T1>(Action<T0, T1> action, T0 data0, T1 data1)
    {
        if (action == null)
        {
            return;
        }
        action(data0, data1);
    }

    public static void SafePostEvent<T0, T1, T2>(Action<T0, T1, T2> action, T0 data0, T1 data1, T2 data2)
    {
        if (action == null)
        {
            return;
        }
        action(data0, data1, data2);
    }

    public static void SafePostEvent<T0, T1, T2,T3>(Action<T0, T1, T2,T3> action, T0 data0, T1 data1, T2 data2, T3 data3)
    {
        if (action == null)
        {
            return;
        }
        action(data0, data1, data2, data3);
    }

    public static void SafePostEvent<T0, T1, T2, T3,T4>(Action<T0, T1, T2, T3, T4> action, T0 data0, T1 data1, T2 data2, T3 data3,T4 data4)
    {
        if (action == null)
        {
            return;
        }

        action(data0, data1, data2, data3, data4);
    }   
}
